<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Api\Controller;
use Illuminate\Http\Request;
use App\Http\Requests\LoginRequest;
use App\Services\LoginServices;
use App\Services\SendCouponServices;
use \App\Services\EasyWeChatServices;

class LoginController extends Controller
{
    //微信登录接口
    public function wx_login(LoginRequest $request,LoginServices $loginService){
       $data = $loginService->wx_login($request->wx_code);
       return $this->success($data);
    }

    public function test_login(Request $request,LoginServices $loginService){
        return $loginService->account_login($request->input('nickname'));
    }

    public function test_fj(Request $request,SendCouponServices $couponServices){
        $number = order_number();
        //发劵
        $couponServices->send_coupon($request->stock_id,$request->open_id,$number);
    }

    public function test_tuikuan(Request $request,EasyWeChatServices $easyWeChatServices){

        //发劵
        $res = $easyWeChatServices->RefundedNotify($request->input('order_number'),order_number(),$request->input('money'),$request->input('money2'));
        dd($res);
    }
}
